<?php
/**
 * Minhlog 入口文件
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 *
 * @category   project
 * @package    project
 * @copyright  Copyright (c) 2009-2010 Minh.Shu@gmail.com
 * @license    New BSD License
 * @author     Minh.Shu
 * @version    $Id: index.php 2 2010-01-17 13:49:08Z Minh.Shu $
 *
 */

// 定义项目启动时间
define('START_TIME', microtime(true));
// 设置全局缓存(true为开启/false为关闭)
define('CACHE_OPTION', false);

// 定义项目路径
defined('APPLICATION_PATH')
        || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/application'));

// 定义项目环境
defined('APPLICATION_ENV')
        || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development'));

// 设置引用路径
set_include_path(
        implode(PATH_SEPARATOR,array(realpath(APPLICATION_PATH . '/../library'),get_include_path())));

// 开启自动加载
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->setFallbackAutoloader(true);

// 会话开始
Zend_Session::start();

// 初始化Zend_Application
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');

// 项目执行
try {
    $application->getBootstrap()->bootstrap('frontController');
    $application->getBootstrap()->bootstrap('router');
    $application->run();
} catch (Exception $e) {
    echo "catch exception: " . get_class($e) . "<br>";
    echo "exception message: " . $e->getMessage() . "<br>";
}